#ifndef __PVMVOICE_H__
#define __PVMVOICE_H__

#include "pvm/pvmtypes.h"
#include "lib/pvmrefcounter.h"

class IPVMVoice : public APVMRefCounter
{
protected:
	IPVMVoice() {isOwned = false;};
	pvm_bool isOwned;
public:
	virtual ~IPVMVoice() 
	{

	};

	pvm_bool IsOwned() {return isOwned;};
	void SetIsOwned(pvm_bool ownFlag) {isOwned = ownFlag;};

	virtual void GetFormat(pvm_uint32 &samplesPerSecond, pvm_uint32 &bitsperSample, pvm_uint32 &chanels)=0;
	virtual pvm_uint32 GetSamplesPerSecond() = 0;
	virtual pvm_uint32 GetBitsPerSample() = 0;
	virtual pvm_uint32 GetChanelsNum() = 0;

	virtual pvm_uint32 FillBuffer(void *buffer, pvm_uint32 numSamples) = 0;//returns number of rendered samples
	virtual void SetPause(pvm_bool pause) = 0;
	virtual pvm_bool GetPause() = 0;
	virtual pvm_bool IsAlive() = 0;//return non zero if chanel alive, otherwise chanel will be destroyed
	virtual void DoDestroy() = 0;//should free memmory (e.g. call delete this;), inherited from APVMRefCounter

	virtual void OnIdle() = 0;

	virtual void SetLoopCount(pvm_int32 loopCount) = 0;
	virtual pvm_int32 GetLoopCount() = 0;
	virtual pvm_bool SetLoopInSamples(pvm_int64 loopFrom, pvm_int64 loopTo) = 0;
	virtual pvm_bool GetLoopInSamples(pvm_int64 &loopFrom, pvm_int64 &loopTo) = 0;
	virtual pvm_bool GetLoopInMS(pvm_int32 &loopFrom, pvm_int32 &loopTo) = 0;
	
	virtual pvm_int32 GetPositionMS() = 0;//return playing position, or -1 if not supported
	virtual pvm_bool SetPositionMS(pvm_int32 position) = 0;//return true if new position has been set

	virtual pvm_bool GetOption(const pvm_char* optionName, void* optionVal, pvm_uint32* optionSize) = 0;
	virtual pvm_bool SetOption(const pvm_char* optionName, void* optionVal, pvm_uint32 optionSize) = 0;
};

#endif
